#include "mainbaclientdlg.h"
#include "ui_mainbaclientdlg.h"
#include <QFileDialog>
#include <QListView>

MainBAClientDlg::MainBAClientDlg(QTcpSocket *tcpSocket, QWidget *parent) :
    QDialog(parent),
    ui(new Ui::MainBAClientDlg)
{
    ui->setupUi(this);
    this->tcpSocket = tcpSocket;
}

MainBAClientDlg::~MainBAClientDlg()
{
    delete ui;
}

void MainBAClientDlg::on_selectFilesBtn_clicked()
{
    QFileDialog *fileDialog = new QFileDialog(this);
    fileDialog->setWindowTitle(tr("打开"));
    fileDialog->setDirectory(".");
    fileDialog->setNameFilter(tr("All files(*.*)"));
    /*QListView *listView = fileDialog->findChild<QListView*>("listView");
    if (listView)
        listView->setSelectionMode(QAbstractItemView::ExtendedSelection);*/
    filesPath += fileDialog->getOpenFileNames();
    ui->filesListTextEdit->append(filesPath.join("\n"));
}

void MainBAClientDlg::on_quitBtn_clicked()
{
    this->close();
}

void MainBAClientDlg::on_beginBtn_clicked()
{
    //发送文件
    tcpSocket->write("Hello, world!");
    //接收结构
}
